# encoding: utf-8
""" 
@version: v1.0 
@author: autumner 
@license: Apache Licence  
@contact: 18322313385@163.com 
@site:  
@software: PyCharm 
@file: class_repr.py 
@time: 2019/6/11 12:32
"""
'''
改变对象实例的打印或显示输出
'''
class Pair:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def __repr__(self):
        return 'Pair({0.x!r}, {0.y!r})'.format(self)

    def __str__(self):
        return '({0.x!s}, {0.y!s})'.format(self)


p = Pair(27,99)
print(p)

print('p is {0!r}'.format(p))
print('p is {0}'.format(p))
print('p is {0!s}'.format(p))